<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>党建网</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../../assets/css/amazeui.css"/>
  <link rel="stylesheet" href="../../assets/css/admin.css">
  <link rel="stylesheet" href="../../css/pagination.css">

</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<header class="am-topbar amt-header">
</header>

<div class="am-cf">
  <!-- sidebar start -->
   <div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
  </div>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
      <div class="am-cf am-padding" style="margin-left:2%">
                    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg" style="color:#BD2D30">视频列表</strong></div>
                </div>

	<div class="am-g am-margin-top" style="margin-left:4%">
           
                            <div class="am-u-sm-3 am-u-end col-end ">主栏目：
                                <select data-am-selected id="mcol"> 
                                </select>
                            </div>
                            
                           
                            <div class="am-u-sm-3 am-u-end col-end" >子栏目：
                                <select data-am-selected id="scol"> 
                                </select>
                            </div>
                            
                             <div class="am-u-sm-1 am-u-end col-end" >
                                 <button type="button" class="am-btn am-btn-primary am-btn-sm" id="" style="background:#BD2D30;border-color:#BD2D30;margin-left:1%">搜索</button>
                            </div>
          </div></br>
		
	

	    <div class="am-g">
      <div class="am-u-sm-12 " style="margin-left:0%">
        <form >
         <table class="am-table am-table-striped table-main" id="sitetable">
            <thead>
              <tr style="font-size:15px">
                <th>选 定</th><th>标 题</th><th>发 布 时 间</th><th>操作</th>
              </tr>
          </thead>
          <tbody id="infoList">
              	
          </tbody>
                  </table>
        </form>
      </div>
    </div>
    <div class="am-margin" id="rtn_btn_div">
				<div class="am-g am-margin-top">
					<div class="am-u-sm-2 am-u-md-3 am-text-letf">
						<button type="button" class="am-btn am-btn-primary am-btn-xs"
							id="rtn_btn">批量删除</button>
                            <button type="button" class="am-btn am-btn-primary am-btn-xs"
							id="all_btn">全选</button>
                            <button type="button" class="am-btn am-btn-primary am-btn-xs"
							id="reall_btn">反选</button>
					</div>
					
					
					<div class="am-u-sm-10 am-u-md-10 " id="page_div">
						<div class="M-box3" style="float:right"></div>
					</div>
				</div>
			</div>

  </div>
  <!-- content end -->

</div>

<a href="#" class="am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}">
  <span class="am-icon-btn am-icon-th-list"></span>
</a>


<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="/assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="../../assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="../../assets/js/amazeui.min.js"></script>
<script src="../../js/left-nav.js"></script>
<script src="../../js/header.js"></script>
<script src="../../js/jquery.pagination.js"></script>
<script src="../../js/index.js"></script>
<script src="../../js/global.js"></script>
<script src="../../js/vList.js"></script>
<script >
    $(document).ready(function(){
        $("#collapse-nav-2").addClass("am-in");
        searchMcol();
        searchScol();
        
        $.ajax({
			type : "GET",
			url : "/partyBuilding/vedio/curPage/1/pageSize/10" ,
			contentType : "application/json",
			dataType : "json",
			success : function(data) {
				//alert(JSON.stringify(data));
				if(data.code == "200") {
					var pag = data.pageInfo.totalCount; //信息列表总记录数目
					pagination(pag, 1);
					showList(data);
					PageBtn();
				}
			},
			error : function() {
				
			}
		});  
    })
    
    function showList(data){
    	$("#infoList").html("");
    	$.each(data.vedios, function(num, vedios) {
        $("#infoList").append('<tr><td><input type="checkbox" value="'+vedios.pkVedio+'" id="'+vedios.pkVedio+'"></td><td>'+vedios.vedioTitle+'</td><td>'+getDate(vedios.vedioUploadTime)+'</td>'+
        '<td><div class="am-btn-toolbar"><div class="am-btn-group am-btn-group-xs"> '+
        '<button type="button"class="am-btn am-btn-default am-btn-xs am-text-secondary am-hide-sm-only" onclick="viewVideo(this)" pkVedio="'+vedios.pkVedio+'"><span class="am-icon-pencil-square-o"></span> 详情</button>'+
        '<button type="button"class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="del(this)" pkVedio="'+vedios.pkVedio+'"><span class="am-icon-trash"></span> 删除</button>'+
         '</div></div></td></tr>');
        })
    }
 // 删除按钮点击事件
    function del(node){
        var pkVedio = node.getAttribute("pkVedio");
        //alert(pkVedio);
        $.ajax({
        	type : "GET",
        	url : "/partyBuilding/vedio/delete/"+pkVedio,
        	data :{
        		pkVedio:pkVedio,
         	},
        	contentType : "application/json",
        	dataType : "json",
        	success : function(data) {
        		//alert(JSON.stringify(data));
        		
        		if(data.code == "200") {
        			alertModal("提示", "删除成功", function() {
					});
        			node.parentNode.parentNode.parentNode.parentNode.remove();
        		}
        		
        	},
        	error : function() {
        		alertModal("提示", "不能删除", function() {
				});
        		
        	}
        });  
    }
    	var totalPage = 0; //总页数
	function pagination(pag, cur) {

		var page = 1; //页数
		page = parseInt(pag / 10);
		var pageSize = (pag % 10);
		if (pageSize == 0) {
			totalPage = page;
		} else {
			totalPage = page + 1;
		}

		$('.M-box3').pagination({
			pageCount : totalPage,
			current : cur,
			jump : true,
			coping : true,
			homePage : '首页',
			endPage : '末页',
			prevContent : '上页',
			nextContent : '下页'
		});

	}
</script>

</body>
</html>
